package paper

import (
	"data/view"
	"data/view/question"
	"time"
)

type CreatePaperParam struct {
	view.BaseAccessToken
	Name       string   `json:"name"`       //试卷名
	Subject    string   `json:"subject"`    //科目
	Limit_time int      `json:"limit_time"` //考试时间
	Questions  []string `json:"questions"`  //题目集合
	Attach     string   `json:"attach"`     //附加
	Pass_score float64  `json:"pass_score"` //及格分数
}

type UpdatePaperParam struct {
	view.BaseAccessToken
	Paper_no   string   `json:"paper_no"`
	Name       string   `json:"name"`       //试卷名
	Subject    string   `json:"subject"`    //科目
	Limit_time int      `json:"limit_time"` //考试时间
	Questions  []string `json:"questions"`  //题目集合
	Attach     string   `json:"attach"`     //附加
	Is_vaild   int      `json:"is_vaild"`   //是否有效（0：是 -1：否）
	Pass_score float64  `json:"pass_score"` //及格分数
}

type GetAllPaperParam struct {
	view.BaseAccessToken
}

type PaperSimpleInfo struct {
	Paper_no        string    `json:"paper_no"`
	Name            string    `json:"name"`
	Topic           string    `json:"topic"`
	Bundle          string    `json:"bundle"`
	Questions       []string  `json:"questions"`
	Operator        string    `json:"operator"`
	Limit_time      int       `json:"limit_time"`
	Attach          string    `json:"attach"`
	Is_vaild        int       `json:"is_vaild"`
	Exam_url        string    `json:"exam_url"`
	Pass_score      float64   `json:"pass_score"`
	Sum_score       float64   `json:"sum_score"`       //总分
	Questions_count int       `json:"questions_count"` //试题数量
	Create_time     time.Time `json:"create_time"`     //创建时间
}

type GetPaperDetailParam struct {
	GetAllPaperParam
	Paper_no string `json:"paper_no"`
}

type PaperAllInfo struct {
	Paper_no        string                     `json:"paper_no"`
	Name            string                     `json:"name"`
	Topic           string                     `json:"topic"`
	Bundle          string                     `json:"bundle"`
	Questions       []question.Question_return `json:"questions"`
	Operator        string                     `json:"operator"`
	Limit_time      int                        `json:"limit_time"`
	Attach          string                     `json:"attach"`
	Is_vaild        int                        `json:"is_vaild"`
	Exam_url        string                     `json:"exam_url"`        //试卷分享地址
	Pass_score      float64                    `json:"pass_score"`      //及格分数
	Sum_score       float64                    `json:"sum_score"`       //总分
	Create_time     time.Time                  `json:"create_time"`     //创建时间
	Questions_count int                        `json:"questions_count"` //试题数量
}

type SubmitParam struct {
	GetPaperDetailParam
	Teacher     string     `json:"teacher"`
	User_answer []Question `json:"user_answer"`
}

type Question struct {
	Quest_no string   `json:"quest_no"`
	Answer   []string `json:"answer"`
}

type UserAnswer struct {
	User            string             `json:"user"`
	Paper_sum_score float64            `json:"paper_sum_score"` //试卷满分
	Sum_score       float64            `json:"sum_score"`       //总得分
	Pass_score      float64            `json:"pass_score"`      //及格分
	Remark          string             `json:"remark"`          //评语
	Commentator     string             `json:"commentator"`     //评论人
	Remark_time     time.Time          `json:"remark_time"`     //评论时间
	User_answer     []UserAnswerDetail `json:"user_answer"`
}

type UserAnswerDetail struct {
	question.Question_return
	User_answer []string  `gorm:"-" json:"user_answer"` //考生答案
	Test_time   time.Time `json:"test_time"`            //答题时间
	Score       float64   `json:"score"`                //评分
	Answer_time int       `json:"answer_time"`          //回答耗时（秒）
	Examiner    string    `json:"examiner"`             //阅卷人
	Exam_time   time.Time `json:"exam_time"`            //阅卷时间
}

type JudgeScoreParam struct {
	GetAllPaperParam
	User        string          `json:"user"`
	Paper_no    string          `json:"paper_no"`
	Quest_score []QuestionScore `json:"quest_score"`
	Remark      string          `json:"remark"` //评语
	Attach      string          `json:"attach"` //附件
}

type QuestionScore struct {
	Quest_no string  `json:"quest_no"`
	Score    float64 `json:"score"`
}

type Scan_sum struct {
	Sum float64 `json:"sum"`
}

type PaperAnswerer struct {
	Answerer       string  `json:"answerer"`       //考生
	Answerer_score float64 `json:"answerer_score"` //考生总分
	Answer_time    float64 `json:"answer_time"`    //答题总时长 秒
}

type PaperScoreMinandMax struct {
	Min_score float64 `json:"min_score"` //最低分
	Max_score float64 `json:"max_score"` //最高分
}
